function maxArea(height) {
    let left = 0;
    let right = height.length - 1;
    let res = 0;
    while (left <= right) {
        let cur = Math.min(height[left], height[right]) * (right - left);
        res = Math.max(cur, res);
        height[left] < height[right] ? left++ : right--;
    }
    return res;
};